package com.boil.qz.safekavass.web.request.param;

import com.boil.util.Constants;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.Pattern;

/**
 * 更新密码的请求参数。
 *
 * @author ChenYong
 * @date 2017-04-21
 */
public class PasswdParam {
    /**
     * 旧密码
     */
    @NotBlank(message = "旧密码不能为空")
    @Length(min = Constants.VALUE_6, max = Constants.VALUE_20, message = "旧密码的长度在6至20个字符之间")
    @Pattern(regexp = Constants.PASSWD_RE, message = "旧密码由数字、字母组成，且长度在6至20个字符之间")
    private String oldPasswd;
    /**
     * 新密码
     */
    @NotBlank(message = "新密码不能为空")
    @Length(min = Constants.VALUE_6, max = Constants.VALUE_20, message = "新密码的长度在6至20个字符之间")
    @Pattern(regexp = Constants.PASSWD_RE, message = "新密码由数字、字母组成，且长度在6至20个字符之间")
    private String newPasswd;

    /**
     * 默认构造器。
     */
    public PasswdParam() {
        super();
    }

    public String getOldPasswd() {
        return oldPasswd;
    }

    public void setOldPasswd(String oldPasswd) {
        this.oldPasswd = oldPasswd;
    }

    public String getNewPasswd() {
        return newPasswd;
    }

    public void setNewPasswd(String newPasswd) {
        this.newPasswd = newPasswd;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("PasswdParam{");
        sb.append("oldPasswd='").append(oldPasswd).append('\'');
        sb.append(", newPasswd='").append(newPasswd).append('\'');
        sb.append('}');
        return sb.toString();
    }
}